CREATE OR REPLACE VIEW VPI.VIEW_EXTRACT_BATCH_LOG AS
SELECT
	L1.LOG_TIME,
	L1.BATCH_ID,
	L1.PROGRESS_STEP,
	L1.PROGRESS_DESC,
	SUBSTR(L2.LOG_TIME - L1.LOG_TIME, 12)	AS SPENT_TIME
FROM
	VPI.EXTRACT_BATCH_LOG	L2,
	VPI.EXTRACT_BATCH_LOG	L1
WHERE
		L2.PROGRESS_STEP(+)	= L1.PROGRESS_STEP + 1
	AND L2.BATCH_ID(+)		= L1.BATCH_ID
ORDER BY
	L1.BATCH_ID DESC,
	L1.LOG_TIME

WITH READ ONLY;
